package groupware.board.dao;

import groupware.board.vo.NoticeVO;

import java.sql.SQLException;
import java.util.ArrayList;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class NoticeDAOImpl extends SqlMapClientDaoSupport implements NoticeDAO{

	@Override
	public int selectNoticeNextNo() throws SQLException {
		int nextNo=(Integer)this.getSqlMapClient().queryForObject("notice.selectNoticeNextNo");
		return nextNo;
	}

	@Override
	public void insertNoticeContent(NoticeVO vo) throws SQLException {
		this.getSqlMapClient().insert("notice.insertNoticeContent",vo);
	}

	@Override
	public String selectNoticeDateByNo(int no) throws SQLException {
		return (String) this.getSqlMapClient().queryForObject("notice.selectNoticeDateByNo",no);
	}

	@Override
	public void deleteNoticeContent(int no) throws SQLException {
		getSqlMapClient().delete("notice.deleteNoticeContent", no);
	}

	@Override
	public ArrayList<NoticeVO> selectNoticeContentList(String pageNo) throws SQLException {
		System.out.println("Dao selectNoticeContentList....");
		return (ArrayList<NoticeVO>) this.getSqlMapClient().queryForList("notice.selectNoticeContentList", pageNo);
	}

	@Override
	public NoticeVO selectNoticeContent(int no) throws SQLException {
		return (NoticeVO) this.getSqlMapClient().queryForObject("notice.selectNoticeContent", no);
	}

	@Override
	public void updateNoticeCount(int no) throws SQLException {
		getSqlMapClient().update("notice.updateNoticeCount",no);
		
	}

	@Override
	public void updateNoticeContent(NoticeVO vo) throws SQLException {
		this.getSqlMapClient().update("notice.updateNoticeContent",vo);
		
	}

	@Override
	public int selectNoticeTotalContent() throws SQLException {
		return (Integer) this.getSqlMapClient().queryForObject("notice.selectNoticeTotalContent");
	}

}
